package com.dkm.ec.so.repository.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.dkm.base.core.helper.SpringHelper;
import com.dkm.base.db.persistence.dao.IQueryDao;
import com.dkm.biz.repository.AbstractRepository;
import com.dkm.ec.so.domain.ReturnEntity;
import com.dkm.ec.so.repository.ReturnEntityRepository;
import com.dkm.ec.so.persistence.dao.ReturnEntityQueryDao;
import com.dkm.ec.so.persistence.entity.ReturnEntityPo;

/**
 * 对象功能:退货换货单 Repository接口的实现类
 * 开发公司:dkm.com
 * 开发人员:ZHH
 * 创建时间:2017-06-16 20:18:50
 */
@Repository
public class ReturnEntityRepositoryImpl extends AbstractRepository<String, ReturnEntityPo,ReturnEntity> implements ReturnEntityRepository{
	  
	@Resource
	private  ReturnEntityQueryDao returnEntityQueryDao;

	public ReturnEntity newInstance() {
		ReturnEntityPo po = new ReturnEntityPo();
		ReturnEntity returnEntity = SpringHelper.getBean(ReturnEntity.class);
		returnEntity.setData(po);
		return returnEntity;
	}

	public ReturnEntity newInstance(ReturnEntityPo po) {
		ReturnEntity returnEntity = SpringHelper.getBean(ReturnEntity.class);
		returnEntity.setData(po);
		return returnEntity;
	} 
	
	@Override
	protected IQueryDao<String, ReturnEntityPo> getQueryDao() {
		return returnEntityQueryDao;
	}

	@Override
	public List<ReturnEntityPo> getBySoItemId(String soId) {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("soId", soId);
		return returnEntityQueryDao.findByKey("getBySoItemId", params);
	}
	
}
